//
//  ViewController.m
//  MXArcChart
//
//  Created by 马彦 on 16/11/3.
//  Copyright © 2016年 MX. All rights reserved.
//

#import "ViewController.h"
#import "MXArcChart.h"
#import "Masonry.h"

#import "MXPieChartView.h"

@interface ViewController () <MXArcChartDelegate,PieChartViewDelegate>

@property (nonatomic, strong) MXArcChart *arcChart;


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
//    [self ArcChartView];
    self.view.backgroundColor = [UIColor lightGrayColor];
    [self configView];
}

- (void)configView {
    MXPieChartView *pieChartView = [[MXPieChartView alloc] init];
    [self.view addSubview:pieChartView];
    pieChartView.backgroundColor = [UIColor whiteColor];
    [pieChartView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(300);
        make.height.mas_equalTo(300);
        make.center.mas_equalTo(self.view);
    }];
    
    [pieChartView setExtraOffsetsWithLeft:20 top:20 right:20 bottom:20];
    
    pieChartView.sliceSpace = 5;
    pieChartView.colorArray = @[[UIColor redColor],[UIColor blueColor]];
    pieChartView.valueArray = @[@30,@70];
    pieChartView.nameArray = @[@"测试1",@"测试2"];
    
    
    pieChartView.legendStyle = ChartLegendStyleCircle; //底部提示显示样式
    pieChartView.bottomViewStyle = PositionStyleCenter; //底部视图的位置；
    
    /***标题设置***/
    pieChartView.titleName = @"这只是测试";
    pieChartView.titleStyle = PositionStyleLeft;
    pieChartView.titleColor = [UIColor blackColor];
    pieChartView.titleFont = [UIFont systemFontOfSize:17];
    
    pieChartView.delegate = self;
}

- (void)PieChartViewAction {
    
    NSLog(@"点击按钮响应方法");
}




- (void)ArcChartView {
    self.arcChart = [[MXArcChart alloc] init];
    self.arcChart.colors = @[[UIColor redColor],[UIColor blueColor]];
    self.arcChart.valueDataArr = @[@"40",@"60"];
    self.arcChart.nameArray = @[@"共享金额",@"买单实收金额"]; //饼状块名称
    self.arcChart.lineLong = 60;
    
    self.arcChart.titleName = @"进7天共享金额收入占比";
    self.arcChart.style = TitleLocationStyleLeft;
    self.arcChart.titleColor = [UIColor colorWithRed:0.67 green:0.67 blue:0.67 alpha:1.0];  //标题颜色
    self.arcChart.titleFont = [UIFont systemFontOfSize:13];
    self.arcChart.delegate = self;
    [self.view addSubview:self.arcChart];
    
    [self.arcChart mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.view.mas_left);
        make.right.mas_equalTo(self.view.mas_right);
        make.height.mas_equalTo(300);
        make.center.mas_equalTo(self.view);
    }];
    
}


- (void)ringChart:(MXArcChart *)ringChart introduceOnAction:(id)info {
    NSLog(@"问号按钮点击响应事件方法");
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
